<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent">
    <div
      class="content-parent border-hover-style"
      :style="{ backgroundImage: `url(${publicUrls + 'free/style5/Auxiliaryoutlinestyle4Bg.webp'})` }"
    >
      <div class="audio-parent">
        <audioCom :info="props.info" ref="audioParent" />
      </div>

      <div
        class="content"
        v-if="!props.info.remarks && !props.info.subTitle && !props.info.video.url && !props.info.value"
      >
        <div class="title-box">{{ props.info.text }}</div>
      </div>
      <div
        class="content1"
        v-else-if="!props.info.remarks && !props.info.subTitle && (props.info.video.url || props.info.value)"
      >
        <div class="title-box">{{ props.info.text }}</div>
        <div class="img-box1">
          <videoview
            @click="audioplay(false)"
            :info="props.info"
            v-if="props.info.video && props.info.video.url"
          ></videoview>
          <div v-else class="outline-cover">
            <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
          </div>
        </div>
      </div>
      <div
        class="content2"
        v-else-if="props.info.remarks && !props.info.subTitle && !props.info.video.url && !props.info.value"
      >
        <div class="title-box">{{ props.info.text }}</div>
        <div class="remarks">
          <TextMax
            :color2="false"
            :infoData="props.info"
            v-if="props.domShow"
            :data="props.info.remarks"
            :title="props.info.text"
            :row="5"
          ></TextMax>
        </div>
      </div>
      <div
        class="content3"
        v-else-if="props.info.remarks && props.info.subTitle && !props.info.video.url && !props.info.value"
      >
        <div class="title-box">{{ props.info.text }}</div>
        <p class="subtitle" v-if="props.info.subTitle">——{{ props.info.subTitle }}</p>
        <div class="remarks">
          <TextMax
            :color2="false"
            :infoData="props.info"
            v-if="props.domShow"
            :data="props.info.remarks"
            :title="props.info.text"
            :row="3"
          ></TextMax>
        </div>
      </div>
      <div class="content4" v-else>
        <div class="content4-left">
          <div class="title-box">{{ props.info.text }}</div>
          <p class="subtitle" v-if="props.info.subTitle">——{{ props.info.subTitle }}</p>
          <div class="remarks" v-if="props.info.remarks">
            <TextMax
              :color2="false"
              :infoData="props.info"
              v-if="props.domShow"
              :data="props.info.remarks"
              :title="props.info.text"
              :row="2"
            ></TextMax>
          </div>
        </div>
        <div class="img-box2" v-if="(props.info.video && props.info.video.url) || props.info.value">
          <videoview
            @click="audioplay(false)"
            :info="props.info"
            v-if="props.info.video && props.info.video.url"
          ></videoview>
          <div v-else class="outline-cover">
            <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
          </div>
        </div>
      </div>
    </div> 
  </div>
</template>



<script setup lang="ts">
import audioCom from './audioCom.vue';
import { publicUrls, textType } from '@/utils/minxin';
import { useProjectStore } from '@/store';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax5.vue';
import videoview from './../../../videoDialog/videoview.vue';

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
});

const ImgVisible = ref(false);
const audioRef = ref(null);
const audioParent = ref(null);
const videoRef = ref(null);
const isPlay = ref(false);
const store = useProjectStore();
const audioplay = (flag: boolean = true) => {
  audioParent.value.videoplay();
};
</script>

<style scoped lang="less">
.outline-parent {
  display: flex;
  // align-items: flex-end;
  position: relative;
  margin-top: 0;
  height: 100%;
  margin-right: 140px;
}
.content-parent {
  display: flex;
  // align-items: center;
  justify-content: center;
  position: relative;
  margin-top: 66px;
  width: 823px;
  height: 399px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-reflect: below 60% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.audio-parent {
  position: absolute;
  bottom: 55px;
  right: 237px;
  width: 40px;
  height: 40px;
}
.content {
  position: relative;
  display: flex;
  width: 321px;
  height: 28px;
  margin-top: 163px;
}
.content1 {
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 321px;
  margin-top: 56px;
}
.content2 {
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 321px;
  margin-top: 78px;
}
.content3 {
  display: flex;
  align-items: center;
  flex-direction: column;
  width: 321px;
  margin-top: 78px;
}
.title-box {
  width: 100%;
  font-family: SourceBold;
  font-size: 20px;
  color: rgba(63, 95, 92, 1);
  line-height: 28px;
  text-align: center;
}

.subtitle {
  width: 100%;
  font-family: SourceMedium;
  font-size: 16px;
  color: rgba(63, 95, 92, 1);
  line-height: 28px;
  text-align: center;
  font-weight: 400;
  margin-top: 10px;
}
.img-box {
  position: relative;
  overflow: hidden;
  background: rgba(144, 165, 157, 0.2);

  :deep(video) {
    background: rgba(0, 0, 0, 0.3);
  }
}
.img-box1 {
  display: flex;
  width: 323px;
  height: 204px;
  margin-top: 10px;
  background: rgba(144, 165, 157, .2);
  .outline-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    overflow: hidden;
    img {
      transition: all 0.3s;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }
}
.img-box1:hover {
  .outline-cover {
    img {
      transform: scale(1.2);
    }
  }
}
.img-box2 {
  height: 110px;
  margin-top: 10px;
}
.img-box3 {
  height: 184px;
  margin-top: 10px;
}
.img-box4 {
  height: 237px;
  margin-top: 10px;
}

.remarks {
  width: 100%;
  margin-top: 10px;
}
.content4 {
  display: flex;
  justify-content: center;
  width: 823px;
  padding: 73px 171px 0px 196px;
}
.content4-left {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  width: 256px;
  height: 196px;
}
.img-box2 {
  display: flex;
  width: 190px;
  height: 190px;
  margin-top: 10px;
  border-radius: 50%;
  overflow: hidden;
  margin-top: 3px;
  margin-left: 10px;
  .outline-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    overflow: hidden;
    img {
      transition: all 0.3s;
      width: 100%;
      height: 100%;
      object-fit: cover;
    }
  }
}
.img-box2:hover {
  .outline-cover {
    img {
      transform: scale(1.2);
    }
  }
}
</style>
